package com.example.mobile2021606159yhf0427;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private TextView tvMaintingchechang;
    private TextView tvMainkongwei;
    private TextView tvMainjiage;
    private TextView tvMainjuli;
    private TextView tvMiandizhi;
    private TextView tvMainother;
    private RecyclerView rvMainlist;
    private ImageView ivMaintupian;
    private List<Tingchechang> list = new ArrayList();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
        rvMainlist.setLayoutManager(new LinearLayoutManager(this));
        rvMainlist.setAdapter(new rv_main_list(list));
    }

    private void initView() {
        tvMaintingchechang = (TextView) findViewById(R.id.tv_main_tingchechang);
        tvMainjiage = (TextView) findViewById(R.id.tv_main_jiage);
        tvMainkongwei = (TextView) findViewById(R.id.tv_main_kongwei);
        tvMainjuli = (TextView) findViewById(R.id.tv_main_juli);
        tvMiandizhi = (TextView) findViewById(R.id.tv_main_dizhi);
        tvMainother = (TextView) findViewById(R.id.tv_main_other);
        rvMainlist = (RecyclerView) findViewById(R.id.rv_main_list);
        ivMaintupian = (ImageView) findViewById(R.id.iv_main_tupian);
    }

    private void initData() {
        list.add(new Tingchechang("国际大夏停车场", "空位：30",
                "价格：5元/小时", "距离：20公里", "地址：佛山市高明区富湾镇学府路8号",
                "更多信息"));
        list.add(new Tingchechang("国际大夏停车场", "空位：30",
                "价格：5元/小时", "距离：20公里", "地址：佛山市高明区富湾镇学府路8号",
                "更多信息"));
        list.add(new Tingchechang("国际大夏停车场", "空位：30",
                "价格：5元/小时", "距离：20公里", "地址：佛山市高明区富湾镇学府路8号",
                "更多信息"));
        list.add(new Tingchechang("国际大夏停车场", "空位：30",
                "价格：5元/小时", "距离：20公里", "地址：佛山市高明区富湾镇学府路8号",
                "更多信息"));
        list.add(new Tingchechang("国际大夏停车场", "空位：30",
                "价格：5元/小时", "距离：20公里", "地址：佛山市高明区富湾镇学府路8号",
                "更多信息"));
        list.add(new Tingchechang("国际大夏停车场", "空位：30",
                "价格：5元/小时", "距离：20公里", "地址：佛山市高明区富湾镇学府路8号",
                "更多信息"));
    }
}